package com.wn.procurement.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wn.common.PageBean;
import com.wn.entity.ReturnCargo;
import com.wn.procurement.mapper.ReturnCargoMapper;
import com.wn.procurement.service.ReturnCargoService;
import com.wn.procurement.vo.ReturnCargoVo;
import com.wn.utils.PageBeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReturnCargoServiceImpl implements ReturnCargoService {

    @Autowired
    private ReturnCargoMapper returnCargoMapper;

    @Override
    public void insert(ReturnCargo returnCargo) {
        returnCargoMapper.insert(returnCargo);
    }

//    @Override
//    public void update(ReturnCargo returnCargo) {
//        returnCargoMapper.(returnCargo);
//    }

//    @Override
//    public PageBean<ReturnCargo> getAll() {
//        return null;
//    }

    @Override
    public PageBean<ReturnCargo> getByCondition(ReturnCargoVo returnCargoVo) {
        Page<ReturnCargo> page = PageHelper.startPage(returnCargoVo.getCurrPage(), returnCargoVo.getPageSize());
        List<ReturnCargo> list = returnCargoMapper.getByCondition(returnCargoVo.getReturnCargo());
        return PageBeanUtil.getPageBean(list, page, returnCargoVo.getCurrPage(), returnCargoVo.getPageSize());

    }
}
